<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>增填删除表格记录</title>
    <script src="https://code.jquery.com/jquery-3.6.4.min.js" integrity="sha256-oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl+cbzUq8=" crossorigin="anonymous"></script>
    <script>
        $(function () {
            $("button:first").click(function () {
                var x1=$("input:first").val(),x2=$("input:eq(1)").val(),x3=$("input:last").val();
                alert(x1+x2+x3);
                $("<tr>" +
                    "<td>"+ x1 +"</td>"+
                    "<td>"+ x2 +"</td>"+
                    "<td>"+ x3+ "</td>"+
                    "<td>"+"<a href=\"deleteEmp?\" id=\"001\">Delete</a>"+"</td>"+
                    "</tr>").appendTo($("table:first"));
            });

            $("button:last").click(function () {
                alert();
            });

            $("a").click(function () {
                var $p=$(this).parent.parent;
                var pp=$p.find("td:first").text();
                if( confirm("是否确认删除？"+pp) )
                {
                    $p.remove();
                    return false;
                }


                return false;
            });
        });
    </script>
</head>
<body>
    <table border="1px solid pink" align="center" width="400px">
        <tr>
            <td>Name</td>
            <td>Email</td>
            <td>Salary</td>
            <td> </td>
        </tr>
        <tr>
            <td>Tom</td>
            <td>123456@qq.com</td>
            <td>5000</td>
            <td><a href="deleteEmp?" id="001">Delete</a></td>
        </tr>
        <tr>
            <td>Tom</td>
            <td>123456@qq.com</td>
            <td>5000</td>
            <td><a href="deleteEmp?" id="003">Delete</a></td>
        </tr>
    </table>
    <br/>
    <table align="center" border="1px solid pink">
        <tr>
            <td colspan="2"><h4>增填新员工</h4></td>
        </tr>
        <tr>
            <td>name:</td>
            <td><input type="text"></td>
        </tr>
        <tr>
            <td>email:</td>
            <td><input type="text"></td>
        </tr>
        <tr>
            <td>salary:</td>
            <td><input type="text"></td>
        </tr>
        <tr>
            <td colspan="2" align="center"><button>提交</button></td>
        </tr>
    </table>
    <button id="xxx">test</button>
</body>
</html>